package com.stgl.service;

import com.stgl.dao.WechartDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class WechartService {
    @Autowired
    private WechartDao wechartDao;

    public List<Map<String,Object>>getuserBindStu(Map<String,Object>gmap)
    {
        List<Map<String,Object>>list1=wechartDao.getuserBindStu(gmap);
        return list1;
    }

    public List<Map<String,Object>>getAllSchool()
    {
        List<Map<String,Object>>list1=wechartDao.getAllSchool();
        return list1;
    }



    public List<Map<String,Object>>findStudentExist(Map<String,Object>gmap)
    {
        List<Map<String,Object>>list1=wechartDao.findStudentExist(gmap);
        return list1;
    }



    public int registStudent(Map<String,Object>gmap)
    {
        return wechartDao.registStudent(gmap);
    }


    public List<Map<String,Object>>getWhkCategory(Map<String,Object>gmap)
    {
        List<Map<String,Object>>list1=wechartDao.getWhkCategory(gmap);
        for(int i=0;i< list1.size();i++){
            Map<String,Object>maps=list1.get(i);
            String wid=maps.get("WID").toString();
            List<Map<String,Object>>teas=wechartDao.getWhkTeaById(wid);
            maps.put("teas",teas);
        }
        return list1;
    }
    public List<Map<String,Object>>getStfdCategory(Map<String,Object>gmap)
    {
        List<Map<String,Object>>list1=wechartDao.getStfdCategory(gmap);
        for(int i=0;i< list1.size();i++){
            Map<String,Object>maps=list1.get(i);
            String sid=maps.get("SID").toString();
            List<Map<String,Object>>teas=wechartDao.getSthdTeaById(sid);
            maps.put("teas",teas);
        }
        return list1;
    }



    public List<Map<String,Object>>getWhkDetails(String wid)
    {
        List<Map<String,Object>>list1=wechartDao.getWhkDetails(wid);
        return list1;
    }
    public List<Map<String,Object>>getSfDetails(String wid)
    {
        List<Map<String,Object>>list1=wechartDao.getSfDetails(wid);
        return list1;
    }
    public List<Map<String,Object>>getTeasDetails(String wid)
    {
        List<Map<String,Object>>list1=wechartDao.getWhkTeaById(wid);
        return list1;
    }



    public List<Map<String,Object>>getSthdDetails(String sid)
    {
        List<Map<String,Object>>list1=wechartDao.getSthdDetails(sid);
        return list1;
    }
    public List<Map<String,Object>>getSthdSfDetails(String sid)
    {
        List<Map<String,Object>>list1=wechartDao.getSthdSfDetails(sid);
        return list1;
    }
    public List<Map<String,Object>>getSthdTeasDetails(String sid)
    {
        List<Map<String,Object>>list1=wechartDao.getSthdTeaById(sid);
        return list1;
    }

    public List<Map<String,Object>>getWhkTeaById(String wid)
    {
        List<Map<String,Object>>teas=wechartDao.getWhkTeaById(wid);
        return teas;
    }



    public List<Map<String,Object>>FindBmqkXe(String wid)
    {
        List<Map<String,Object>>xe=wechartDao.FindBmqkXe(wid);
        return xe;
    }

    public int InsertBmqk(Map<String,Object>gmap)
    {
        return wechartDao.InsertBmqk(gmap);
    }
    public int InsertBmqkZl(Map<String,Object>gmap)
    {
        return wechartDao.InsertBmqkZl(gmap);
    }
    public int InsertOrderlist(Map<String,Object>gmap)
    {
        return wechartDao.InsertOrderlist(gmap);
    }
    public int InsertOrderfee(Map<String,Object>gmap)
    {
        return wechartDao.InsertOrderfee(gmap);
    }
    public int InsertOrdertea(Map<String,Object>gmap)
    {
        return wechartDao.InsertOrdertea(gmap);
    }



    public void EditStudent(Map<String,Object>gmap)
    {
        wechartDao.EditStudent(gmap);
        wechartDao.EditUaccount(gmap);
    }




    public List<Map<String,Object>>orderList(Map<String,Object>gmap)
    {
        List<Map<String,Object>>list1=wechartDao.orderList(gmap);
        for(int i=0;i<list1.size();i++){
            Map<String, Object>maps=list1.get(i);
            String oid=maps.get("OID").toString();
            List<Map<String,Object>>fees=wechartDao.listorderfee(oid);
            List<Map<String,Object>>teas=wechartDao.listordertea(oid);
            maps.put("fees",fees);
            maps.put("teas",teas);
        }
        return list1;
    }



    public int orderCount(Map<String,Object>gmap)
    {
        int c=wechartDao.orderCount(gmap);
        return c;
    }





    public void delOrder(Map<String,Object>gmap)
    {
        wechartDao.delOrder(gmap);
        return ;
    }



    public void cancelOrder(Map<String,Object>gmap)
    {
        wechartDao.cancelOrder(gmap);
        return;
    }


    public void updatebmqktocancel(Map<String,Object>gmap)
    {
        wechartDao.updatebmqktocancel(gmap);
        return;
    }


    public Map<String, Object>orderWhk_list(String oid)
    {
        List<Map<String,Object>>list1=wechartDao.orderWhk_list(oid);
        Map<String,Object>maps=new HashMap<>();
        if(list1.size()>0){
            maps=list1.get(0);
            List<Map<String,Object>>fees=wechartDao.listorderfee(oid);
            List<Map<String,Object>>teas=wechartDao.listordertea(oid);
            maps.put("pris",fees);
            maps.put("teas",teas);
        }
        return maps;
    }



    public void paysuccess(Map<String,Object>gmap)
    {
        wechartDao.paysuccess(gmap);
        return;
    }



    public List<Map<String,Object>>getOrderInfoByid(Map<String,Object>gmap)
    {
        List<Map<String,Object>>list1=wechartDao.getOrderInfoByid(gmap);
        return list1;
    }


    public List<Map<String,Object>>findStuBmqk(Map<String,Object>gmap)
    {
        List<Map<String,Object>>list1=wechartDao.findStuBmqk(gmap);
        return list1;
    }


    public List<Map<String,Object>>findStuBmdFdb(Map<String,Object>gmap)
    {
        List<Map<String,Object>>list1=wechartDao.findStuBmdFdb(gmap);
        return list1;
    }


}
